#!/bin/bash

# Script to test FortranFlowMap.py on multiple Fortran projects

# Ensure we're in the correct directory
cd $(dirname $0)

# List of projects to analyze
# projects="fwat_release  unicycle"
# grond specfem3d
# Loop through each project and generate function trees
# for proj in $projects
# do
#     echo "Analyzing project: $proj"
#     python FortranFlowMap.py --src ../project/$proj --root $proj 
#     echo "Completed analysis for $proj"
#     echo "----------------------------------------"
# done
echo "Analyzing project 1: unicycle"
python FortranFlowMap.py --src ../project/unicycle --root unicycle --filter=getdata
echo "Analyzing project 2: fwat_release"
modules="fwat0_forward_data fwat1_fwd_measure_adj fwat2_postproc_opt fullwave_adjoint_tomo xmeasure_adj xflexwin"
for root in $modules
do
    python FortranFlowMap.py --src ../project/fwat_release  --root $root --output_dir Output/fwat/
done

echo "Analyzing project 3: specfem3d"
python FortranFlowMap.py --src ../project/specfem3d/src --all --output_dir Output/specfem3d/


echo "All projects analyzed. Check the Output directory for results." 